using QFramework;
using TMPro;
using UnityEngine;

public class CardDisplay : MonoBehaviour, IController
{
    [SerializeField] TextMeshProUGUI textName;
    [SerializeField] TextMeshProUGUI textDescription;
    [SerializeField] TextMeshProUGUI textCost;
    [SerializeField] TextMeshProUGUI textHealth;
    [SerializeField] TextMeshProUGUI textAttack;
    public TextMeshProUGUI textCount;
    [SerializeField] CardType cardType;

    public Card Card { get; set; }

    void Start()
    {
        Display();
    }

    public void Display()
    {
        switch (this.cardType)
        {
            case CardType.StoreCard:
                // this.textCount.gameObject.SetActive(false);
                break;
            case CardType.DeckCard:
                break;
            case CardType.BattleCard:
                break;
        }

        this.textName.text = this.Card.Name;
        this.textDescription.text = this.Card.Description;
        this.textCost.text = this.Card.Cost.ToString();
        this.textCount.text = this.Card.Count.ToString();

        string type = this.Card.GetType().Name;

        switch (type)
        {
            case nameof(MonsterCard):
                var monsterCard = this.Card as MonsterCard;
                this.textHealth.text = monsterCard.Health.ToString();
                this.textAttack.text = monsterCard.Cost.ToString();
                break;
            case nameof(SpellCard):
                this.textHealth.gameObject.SetActive(false);
                this.textAttack.gameObject.SetActive(false);
                break;
        }
    }

    public IArchitecture GetArchitecture()
    {
        return CardGame.Interface;
    }
}
